package joonany.basic.j04;

import java.util.Scanner;

public class J04_SungJuk{
	
	
	public static void main(String[] args) {
				
		Scanner sc = new Scanner(System.in);
		
		String name;	
		int kor, eng, mat, tot;		
		float avg;
		char grd;
		
		final char SU = '수';
		final char OO = '우';
		final char MI = '미';
		final char YANG = '양';
		final char GA = '가';
		
		System.out.print("이름을 입력하세요 : ");
		name = sc.next();
		System.out.print("국어 점수를 입력하세요 : ");
		kor = sc.nextInt();
		System.out.print("영어 점수를 입력하세요 : ");
		eng = sc.nextInt();
		System.out.print("수학 점수를 입력하세요 : ");
		mat = sc.nextInt();
		
		grd = ' ';
		
		sc.close();
		
		tot = kor + eng + mat;
		avg = tot / 3;
		
		/*
		if (avg >= 90) { grd = '수'; }
		if (80 <= avg && avg < 90){ grd = '우'; }
		if (70 <= avg && avg < 80){ grd = '미'; }
		if (60 <= avg && avg < 70){ grd = '양'; }
		if (0 <= avg && avg < 60){ grd = '가'; }
		*/
		/*
		if (avg >= 90){grd = '수';}
		if (80 <= avg){grd = '우';}
		if (70 <= avg){grd = '미';}
		if (60 <= avg){grd = '양';}
		if (00 <= avg){grd = '가';}
		*/		
		
		if (avg >= 90){grd = SU;}
		else if (avg >= 80){grd = OO;}
		else if (avg >= 70){grd = MI;}
		else if (avg >= 60){grd = YANG;}
		else {grd = GA;}
		

		
//		System.out.println(name);
//		System.out.println(kor);
//		System.out.println(eng);
//		System.out.println(mat);
//		System.out.println(tot);
//		System.out.println(avg);

		
		// switch 의 평가식의 결과값은 반드시 char, int, Enum(열거형) 형이어야 함
		// 단, JDK7부터는  String도 사용 가능
		/*switch ((int)avg){
		case 100 : grd = SU;
		case 99 : grd = SU;
		case 90 : grd = SU;
		
		case 89 : grd = OO;
		case 88 : grd = OO;
		case 80 : grd = OO;
		
		case 79 : grd = MI;
		case 78 : grd = MI;
		case 70 : grd = MI;
		
		case 69 : grd = YANG;
		case 68 : grd = YANG;
		case 60 : grd = YANG;
		
		case 59 : grd = GA;
		case 58 : grd = GA;
		case 50 : grd = GA;
		
		default : System.out.println("잘못된 학점");
		}*/
		
		switch ((int)avg / 10){
		
		case 10 : 
		case 9 : grd = SU; break;
		case 8 : grd = OO; break;
		case 7 : grd = MI; break;
		case 6 : grd = YANG; break;
		default : grd = GA;
		}
		
		
		
		System.out.println("이름 : " + name);
		System.out.println("국어 : " + kor);
		System.out.println("영어 : " + eng);
		System.out.println("수학 : " + mat);
		System.out.println("총점 : " + tot);
		System.out.println("평균 : " + avg);
		System.out.println("학점 : " + grd);
		
		
	}

}
